package com.nhy.bloggers.configur;

import lombok.Data;

@Data
public class Result {
    private int code;
    private String msg;
    private Object data;

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(Constant.RESULT_CODE_SUCCESS);
        result.setMsg("");
        result.setData(data);
        return result;
    }

    public static Result fail(int code, String msg) {
        Result result = new Result();
        result.setCode(Constant.RESULT_CODE_FAIL);
        result.setMsg(msg);
        result.setData("");
        return result;
    }

    public static Result unLogin(int code, String msg, Object data) {
        Result result = new Result();
        result.setCode(Constant.RESULT_CODE_UN_LOGIN);
        result.setMsg("用户未登录");
        result.setData(data);
        return result;
    }
}
